//
//  ImageDownloader.h
//  NewsReader
//
//  Created by blacksun on 10-11-23.
//  Copyright 2010 __MyCompanyName__. All rights reserved.
//

#import <Foundation/Foundation.h>
#import "Feed.h"
#import "HttpUtil.h"
#define kMaxRetryCount	5

@protocol ImageDownloaderDelegate;


@interface ImageDownloader : NSObject {
	NSObject *identifier;
	id  <ImageDownloaderDelegate>    delegate;
	NSMutableData *activeDownload;
    NSURLConnection *imageConnection;
	NSString *imageUrl;
	BOOL isConnectioning;
	NSInteger retryCount;
}
@property (nonatomic, retain) NSObject *identifier;
@property (nonatomic, assign) id <ImageDownloaderDelegate> delegate;
@property (nonatomic, retain) NSString *imageUrl; 

@property (nonatomic, retain) NSMutableData *activeDownload;
@property (nonatomic, retain) NSURLConnection *imageConnection;

- (void)startDownload;
- (void)cancelDownload;

@end


@protocol ImageDownloaderDelegate 

- (void)imageLoaded:(UIImage *)image forIdentify:(NSObject *)identifier;

@end